Make a two-dimensional array into a sequence of coordinates
[$ f: (x, y)→\{0, 1\}
[$ \{(x, y) | f(x, y) = 1\}
Advantages
Rotation implementation available
The process in its original form is O(N^2) with width N, but advantageous when $ M := \sum f is asymptotically smaller than that
---
This page is auto-translated from /nishio/二次元配列を座標の列にする. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.